require.config({
    baseUrl: '/lib/', //相对于index.html页面文件的地址
    paths: { //这里配置的地址，都是相对于上方的baseUrl的
        avalon: 'avalon/avalon',
        domReady: 'avalon/domReady',
        mmHistory: 'avalon/mmHistory',
        mmRouter: 'avalon/mmRouter',
        jquery: 'jquery-1.12.4.min',
        bootstrap: 'bootstrap.min',
        bootstrapPaginator: 'bootstrap-paginator'
    },
    shim: {
        avalon: {
            exports: "avalon"
        },
        mmHistory: {
            deps: ['avalon']
        },
        mmRouter: {
            deps: ['avalon']
        },
    }
});

require(['jquery', 'mmHistory', 'mmRouter', "domReady!"], function() {

    var vm = avalon.define({
        $id: "content",
        pageUrl: "/index" //默认为mine.html
    });

    function callback() {

        var path_tail = "/index"; //如果url后缀变成"#!/index"，则pageUrl为“mine.html”
        if (this.path !== "/") {
            path_tail = this.path; //去掉this.path值的第一个斜杠
        }
        var tpath = path_tail.split('/');
        $("#bar li").removeClass("active");
        $("#li_" + tpath[1]).addClass("active");
        vm.pageUrl = path_tail;
    }
    avalon.router.get("/*path", callback); //劫持url hash并触发回调
    avalon.history.start(); //历史记录堆栈管理
    avalon.scan();


    $(".select-title").click(function() {
        $(".list-box").slideToggle("slow");
    });
});